package NES::Memory;

use strict;
use Data::Dumper;

sub new {
    my $class = shift;

    my $self = bless {
        ram  => [ map { 0x0 } (1..0x10000) ],
        vram => [ map { 0x0 } (1..0x4000) ],
        sram => [ map { 0x0 } (1..0x100) ],
    }, $class;

    return $self;
}

sub read {
    my $self = shift;
    my ( $address ) = @_;

    # FIXME
    return $self->{ram}[ $address ];
}

sub write {
    my $self = shift;
    my ( $address, $value ) = @_;

    # FIXME
    $self->{ram}[ $address ] = $value;
}

sub read_vram {
    my $self        = shift;
    my ( $address ) = @_;

    return $self->{vram}[ $address ];
}

sub write_vram {
    my $self                = shift;
    my ( $address, $value ) = @_;

    $self->{vram}[ $address ] = $value;
}

1;